#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

void test_isGameOver() {
        struct gameState* state = newGame();

        //when the provinces are empty
        
        state->supplyCount[curse] = 5;
        state->supplyCount[estate] = 5;
        state->supplyCount[duchy] = 5;
        state->supplyCount[province] = 0;
        state->supplyCount[copper] = 5;
        state->supplyCount[silver] = 5;
        state->supplyCount[gold] = 5;
        state->supplyCount[adventurer] = 5;
        state->supplyCount[council_room] = 5;
        state->supplyCount[feast] = 5;
        state->supplyCount[gardens] = 5;
        state->supplyCount[mine] = 5;
        state->supplyCount[remodel] = 5;
        state->supplyCount[smithy] = 5;
        state->supplyCount[village] = 5;
        state->supplyCount[baron] = 5;
        state->supplyCount[great_hall] = 5;
        state->supplyCount[minion] = 5;
        state->supplyCount[steward] = 5;
        state->supplyCount[tribute] = 5;
        state->supplyCount[ambassador] = 5;
        state->supplyCount[cutpurse] = 5;
        state->supplyCount[embargo] = 5;
        state->supplyCount[outpost] = 5;
        state->supplyCount[salvager] = 5;
        state->supplyCount[sea_hag] = 5;
        state->supplyCount[treasure_map] = 5;

        if (isGameOver(state) == 1) {
                printf("isGameOver(): PASS when test is out of provinces\n");
        }
        else {
                printf("isGameOver(): FAIL when test is out of provinces\n");
        }

        //when 3 of the supplies are empty

        state->supplyCount[curse] = 5;
        state->supplyCount[estate] = 5;
        state->supplyCount[duchy] = 5;
        state->supplyCount[province] = 5;
        state->supplyCount[copper] = 5;
        state->supplyCount[silver] = 5;
        state->supplyCount[gold] = 5;
        state->supplyCount[adventurer] = 0;
        state->supplyCount[council_room] = 0;
        state->supplyCount[feast] = 5;
        state->supplyCount[gardens] = 0;
        state->supplyCount[mine] = 5;
        state->supplyCount[remodel] = 5;
        state->supplyCount[smithy] = 5;
        state->supplyCount[village] = 5;
        state->supplyCount[baron] = 5;
        state->supplyCount[great_hall] = 5;
        state->supplyCount[minion] = 5;
        state->supplyCount[steward] = 5;
        state->supplyCount[tribute] = 5;
        state->supplyCount[ambassador] = 5;
        state->supplyCount[cutpurse] = 5;
        state->supplyCount[embargo] = 5;
        state->supplyCount[outpost] = 5;
        state->supplyCount[salvager] = 5;
        state->supplyCount[sea_hag] = 5;
        state->supplyCount[treasure_map] = 5;

        if (isGameOver(state) == 1) {
                printf("isGameOver(): PASS when test is out of three card stacks\n");
        }
        else {
                printf("isGameOver(): FAIL when test is out of three card stacks\n");
        }

}

int main() {
        test_isGameOver();
}
